import json
import random
import time
 
import paho.mqtt.client as mqtt
 
 
test=0
test_username=''
test_passwd=''
test_broker='127.0.0.1'
test_port = 9999
count=11110
broker = '127.0.0.1'
port = 1883
username = 'shhooseerver001'
passwd = 'shhoo2018'
if test is True:
    broker =test_broker
    port = test_port
    username = test_username
    passwd = test_passwd
topic = "E00120220718171201/PF/PP01/get_process"
def publish():
    global count
    count+=1
    client = mqtt.Client()
    client.username_pw_set(username, passwd)
    client.connect(host=broker, port=port)
    while 1:
        time.sleep(4.3)
        for i in range(1):
            msg = {
  "message_id":count
}
            r=client.publish(topic=topic, payload=json.dumps(msg), retain=False)
            print(r)
 

if __name__ == '__main__':
    publish()
